package handler

import (
	"gitee.com/simple-set/simple.io/src/event"
	"gitee.com/simple-set/simple.io/src/process/socks"
)

// SocksProcessFactory socks处理器的工厂函数, 创建处理器并设置属性
func SocksProcessFactory() event.Process {
	process := socks.NewProcess()
	// bind 处理器
	process.SetBind(NewSocksBindHandler())
	// connect 处理器
	process.SetConnect(NewSocksConnectHandler())
	// udpAssociate 处理器
	process.SetAssociate(NewSocksAssociateHandler())
	// 注册访问过滤器
	process.AddInterceptor(newSocksInterceptor())
	// 注册身份认证器
	if SocksAuthEnable() {
		process.SetNoAuth(false)
		process.AddAuthenticator(NewSocksAuth())
	}
	return process
}
